import {createRouter, createWebHistory} from "vue-router";
import HomeLayout from "@/components/layout/home-layout/Index.vue";
import CodeGenLayout from "@/components/layout/code-gen-layout/Index.vue";

//代码生成器路由
export const codeGenR = {
    path: "/code-gen",
    name: "代码生成",
    meta: {
        title: "首页",
        showBreadcrumb: false
    },
    component: CodeGenLayout,
    children: [
        {
            path: "/code-gen/data-source",
            name: "数据源管理",
            meta: {
                title: "数据源管理",
                showBreadcrumb: true
            },
            redirect: "/code-gen/data-source/list",
            children: [
                {
                    path: "/code-gen/data-source/list",
                    name: "数据源管理-列表",
                    meta: {
                        title: "列表",
                        showBreadcrumb: true,
                        hidden: true,
                    },
                    component: () => import("@/views/code-gen/data-source/TableList.vue")
                }
            ]
        },
        {
            path: "/code-gen/gen-template",
            name: "模板管理",
            meta: {
                title: "模板管理",
                showBreadcrumb: true
            },
            redirect: "/code-gen/gen-template/list",
            children: [
                {
                    path: "/code-gen/gen-template/list",
                    name: "模板管理-列表",
                    meta: {
                        title: "列表",
                        showBreadcrumb: true,
                        hidden: true,
                    },
                    component: () => import("@/views/code-gen/gen-template/TableList.vue")
                },
                {
                    path: "/code-gen/gen-template/edit",
                    name: "模板管理列表-编辑",
                    meta: {
                        title: "编辑",
                        showBreadcrumb: true,
                        hidden: true,
                    },
                    component: () => import("@/views/code-gen/gen-template/TmpEdit.vue"),
                    props: true
                },
            ]
        },
        {
            path: "/code-gen/gen-task",
            name: "代码生成",
            meta: {
                title: "代码生成",
                showBreadcrumb: true
            },
            redirect: '/code-gen/gen-task/list',
            children: [
                {
                    path: "/code-gen/gen-task/list",
                    name: "代码生成-列表",
                    meta: {
                        title: "列表",
                        showBreadcrumb: true,
                        hidden: true,
                    },
                    component: () => import("@/views/code-gen/gen-task/TableList.vue")
                },
                {
                    path: "/code-gen/gen-task/gen",
                    name: "代码生成-生成",
                    meta: {
                        title: "生成",
                        showBreadcrumb: true,
                        hidden: true,
                    },
                    component: () => import("@/views/code-gen/gen-task/GenCodeEdit.vue")
                },

            ]
        },
        {
            path: "/code-gen/gen-table-col-map",
            name: "表字段映射管理",
            meta: {
                title: "表字段映射管理",
                showBreadcrumb: true
            },
            redirect: "/code-gen/gen-table-col-map/mysql",
            children: [
                {
                    path: "/code-gen/gen-table-col-map/mysql",
                    name: "Mysql",
                    meta: {
                        title: "Mysql",
                        showBreadcrumb: true
                    },
                    component: () => import("@/views/code-gen/gen-table-col-map/mysql/TableList.vue")
                }
            ]
        },
        {
            path: "/global-variable",
            name: "自定义变量",
            meta: {
                title: "自定义变量",
                showBreadcrumb: true
            },
            component: () => import("@/views/code-gen/global-variable/TableList.vue")
        }
    ]
}
const routes = [
    {
        path: "/",
        name: "引导页",
        component: HomeLayout,
        children: [
            {
                path: "/home",
                name: "首页",
                component: () => import("@/views/common/home/Index.vue")
            },
            codeGenR,
        ]
    },
]
export const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: routes
})